package com.qhs.upload.service;

import com.qhs.framework.utils.DateUtil;
import com.qhs.framework.utils.UploadClietUtil;
import org.springframework.stereotype.Service;
import org.springframework.web.multipart.MultipartFile;

/**
 * Created by zano on 2017/3/20.
 */
@Service
public class OSSUploadService {

    public String uploadImg(MultipartFile file){
        UploadClietUtil uploadClietUtil = new UploadClietUtil();
        //文件存储方式以日期为dir
        uploadClietUtil.setFiledir(DateUtil.getSNowDate()+"/");
        String name = uploadClietUtil.uploadImg2Oss(file);
        return uploadClietUtil.getImgUrl(name);
    }
}
